package com.woniuxy.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniuxy.controller.form.TopicPageFrom;
import com.woniuxy.controller.form.VoteAnswerFomr;
import com.woniuxy.controller.info.PageTopicInfo;
import com.woniuxy.controller.info.Result;
import com.woniuxy.service.AnswerService;
import org.springframework.data.domain.Page;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Kevin Martin
 * @since 2022-03-19
 */
@RestController
@RequestMapping("/answer")
public class AnswerController {
    @Resource
    private AnswerService answerService;

    @GetMapping("getAllTopicAnswer")
    public Result<IPage<PageTopicInfo>>  showAllTopicAnswer(TopicPageFrom topicPageFrom){
        return answerService.getTopicAndAnswer(topicPageFrom);
    }
    @PostMapping("voteanswer")
    public Result voteAnswer(@RequestBody VoteAnswerFomr voteAnswerFomr){

        return answerService.voteAnswer(voteAnswerFomr);
    }


}

